package com.leng.admin.controller;


import com.leng.admin.config.LoginService;
import com.leng.common.constant.Constants;
import com.leng.common.core.AjaxResult;
import com.leng.common.core.ApiResult;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
public class LoginController {

    private final LoginService loginService ;

    @GetMapping("aaa")
    public ApiResult login(){
        return ApiResult.success();
    }

    /**
     * 登录方法
     *
     * @return 结果
     */
    @GetMapping("/login")
    public AjaxResult login(String userName,String passWord,String code,String uuid)
    {
        AjaxResult ajax = AjaxResult.success();
        // 生成令牌
        String token = loginService.login(userName,passWord, code, uuid);
        ajax.put(Constants.TOKEN, token);
        return ajax;
    }
}
